//
//  ZHUBaseVC.m
//  proucrement
//
//  Created by zhu on 2017/11/23.
//  Copyright © 2017年 zhu. All rights reserved.
//

#import "baseVC.h"
#import "UIColor+BaseColor.h"
#import "UMAnalytics.h"
@interface baseVC ()

@end

@implementation baseVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    // background color
//    self.view.backgroundColor = [UIColor zhuBackgroundColor];
    
    self.noDataView = [[[NSBundle mainBundle] loadNibNamed:@"QHTNoData" owner:self options:nil] lastObject];
    self.noDataView.frame = CGRectMake(0, 0, KWidth, KHeight);
    
    if (!self.dataDic) {
        self.dataDic = [NSMutableDictionary dictionary];
    }
}

- (void)viewWillAppear:(BOOL)animated
{
    [UMAnalytics beginLogPageView:self.class];
}

- (void)viewWillDisappear:(BOOL)animated
{
    [UMAnalytics endLogPageView:self.class];
}

#pragma mark -- UITableView refresh
- (void)tableViewRefresh:(UITableView *)tableView header:(MJRefreshComponentRefreshingBlock)refreshingBlock
{
    tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
        refreshingBlock ? refreshingBlock() : nil;
    }];
}

- (void)tableViewRefresh:(UITableView *)tableView footer:(MJRefreshComponentRefreshingBlock)refreshingBlock
{
    tableView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{
        refreshingBlock ? refreshingBlock() : nil;
    }];
}

- (void)tableViewEndHeader:(UITableView *)tableView
{
    [tableView.mj_header endRefreshing];
}

- (void)tableViewEndFooter:(UITableView *)tableView
{
    [tableView.mj_footer endRefreshing];
}

// 停止下拉和上拉刷新
- (void)tableViewEndRefresh:(UITableView *)tableView
{
    [self tableViewEndHeader:tableView];
    [self tableViewEndFooter:tableView];
}

#pragma mark -- UIView
//查询无数据
- (void)showNODataView:(BOOL)isShow withLevel:(UIView *)view {
    if (isShow) {
        [view addSubview:self.noDataView];
//        [self.view bringSubviewToFront:self.noDataView];
    }else{
        [self.noDataView removeFromSuperview];
    }
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/



@end
